<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML>
<html lang="en-US">
	<head>
		<meta charset="UTF-8">
		<title>凯盛项目管理系统</title>
		<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
		<link rel = "Shortcut Icon" href="http://www.kaishengit.com/favicon.ico" />
		<script type="text/javascript" src="js/jquery.js"></script>
		<style type="text/css">
.input-xlarge {
	width: 460px;
}
</style>
	</head>
	<body>
		<div class="container">
			<div class="navbar">
				<div class="navbar-inner">
					<div class="container">
						<a href="main" class="brand">凯盛项目管理系统</a>
						<ul class="nav pull-right">
							<li class="active">
								<a>${sessionScope.user.name }</a>
							</li>
							<li>
								<a href="user">个人资料</a>
							</li>
							<li class="divider-vertical"></li>
							<li>
								<a href="loginout">安全退出</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="span3">
					<div class="wall">
						<ul class="nav nav-list">
							<li class="nav-header">
								${project.name }
							</li>
							<li class="divider"></li>
							<li>
								<a href="project?id=${project.id }">
									<i class="icon-home"></i>最新动态
								</a>
							</li>
							<li>
								<a href="goal"> 
									<i class="icon-flag"></i>目标
								</a>
							</li>
							<li class="active">
								<a href="document"> 
									<i class="icon-white icon-folder-open"></i>资料库
								</a>
							</li>
							<li>
								<a href="folder"> 
									<i class="icon-file"></i>文件共享 
								</a>
							</li>
							<li>
								<a href="contact"> 
									<i class="icon-user"></i>联系人 
								</a>
							</li>
							<li>
								<a href="idea">
									<i class="icon-fire"></i>想法 
								</a>
							</li>
							<li>
								<a href="project?m=edit"> 
									<i class="icon-cog"></i>项目设置 
								</a>
							</li>
						</ul>
					</div>
				</div>
				<div class="span9">
					<form id="myform" action="document?m=new" method="post" class="form-horizontal">
						<fieldset>
							<legend>
								分享新资料
							</legend>
							<div class="control-group" id="namediv">
								<label class="control-label" for="document_name">
									资料标题
								</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="document_name"
										name="document_name">
									<p class="help-block">
										请输入资料名称
									</p>
								</div>
							</div>
							<div class="control-group" id="detailsdiv">
								<label class="control-label" for="document_details">
									资料内容
								</label>
								<div class="controls">
									<textarea name="document_details" id="document_details"
										rows="8" class="input-xlarge"></textarea>
								</div>
							</div>
							<div class="form-actions">
								<button class="btn btn-primary" type="button" id="btn">
									添加
								</button>
								<a href="document" class="btn">返回</a>
							</div>
						</fieldset>
					</form>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
			$(document).ready(function() {
	            $("#document_name").focus(function() {
	                $("#namediv").removeClass("error");
	            });
	            $("#document_name").blur(function() {
	                var name = $(this).val();
	                if (name.trim() == "") {
	                    $("#namediv").addClass("error");
	                }
	            });
	            $("#document_details").focus(function() {
	                $("#detailsdiv").removeClass("error");
	            });
	            $("#document_details").blur(function() {
	                var pwd = $(this).val();
	                if (pwd == "") {
	                    $("#detailsdiv").addClass("error");
	                }
	            });
	            $("#btn").click(function() {
	                var name = $("#document_name").val();
	                var pwd = $("#document_details").val();
	                if (name.trim() == "") {
	                    $("#namediv").addClass("error");
	                }
	                if (pwd == "") {
	                    $("#detailsdiv").addClass("error");
	                }
	                if (name.trim() != "" && pwd != "") {
	                    $("#myform").submit();
	                }
	            });
	        });
		</script>
</html>